// -----------------------------
// Author: 		Dhaenens Gert 
// Creation: 	2/26/2015 6:12:16 PM				
// -----------------------------

#ifndef _FilePackage_h
#define _FilePackage_h

#include "Common.h"

namespace Flow
{

	class File;
	class FileManager;

	class FilePackage
	{
	public:

		friend class File;
		friend class FileManager;

		File*			GetFile(const tstring& file) const;

		Bool			ContainsFile(const tstring& file) const;

		const tstring&	GetName() const;
		const tstring&	GetPath() const;

	private:

		static const UInt32	NameLength;

		FilePackage(const tstring& name, const tstring& path);
		~FilePackage();

		Bool				ReadAllFileInfo();
		File*				ReadFileInfo();
		Bool				OpenPackageFile();
		void				ClosePackageFile();

		void				SetPosition(Size_T position);
		void				Read(void* lpData, Size_T dataSize);

		tstring				m_Name;
		tstring				m_Path;
		map<tstring, File*>	m_Files;

		ifstream			m_PackageStream;

		FilePackage(const FilePackage& refFilePackage);
		FilePackage& operator=(const FilePackage& refFilePackage);
	};

}

#endif